package cn.kgc.javase.duotai;

/**
 * @author 课工场
 * @date 2024/8/14
 * @description
 */
public class TestAnimal {

    public static void main(String[] args) {

        // Cat cat = new Cat();
        // cat.walk();
        //
        // Chick chick = new Chick();
        // chick.walk();


        //  多态   子类对象指向父类的引用
        Animal cat = new Cat();
        // cat.walk();
        Animal  chick = new Chick();
        // chick.walk();
        Animal dog = new Dog();
        // dog.walk();


        Person person = new Person();
        person.feed(cat);
        person.feed(chick);
        person.feed(dog);
    }
}
